"""Build rules for tapacc, the TAPA C rewriter."""

# Copyright (c) 2024 RapidStream Design Automation, Inc. and contributors.
# All rights reserved. The contributor(s) of this file has/have agreed to the
# RapidStream Contributor License Agreement.

load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix")

cc_binary(
    name = "tapacc",
    srcs = ["tapacc.cpp"],
    copts = ["-fno-rtti"],
    visibility = ["//visibility:public"],
    deps = [
        "//tapacc/rewriter:task",
        "@tapa-llvm-project//clang:tooling",
    ],
)

pkg_files(
    name = "pkg",
    srcs = [":tapacc"],
    attributes = pkg_attributes(mode = "0755"),
    prefix = "usr/bin",
    strip_prefix = strip_prefix.files_only(),
    visibility = ["//visibility:public"],
)
